day 8 code of hackerrank in java